#include "mainwindow.h"

#include <QApplication>
#include "hello.cuh"
#include <iostream>
#include <cuda_runtime.h>
#include <device_launch_parameters.h>

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

    test_cuda();

    int runtimeVersion;
    int deviceCount;
    cudaError_t err = cudaRuntimeGetVersion(&runtimeVersion);
    if (err == cudaSuccess) {
        std::cout << "CUDA Runtime Version: " << (runtimeVersion / 1000) << "."
                  << (runtimeVersion % 100) << std::endl;
    } else {
        std::cerr << "Failed to get CUDA runtime version: "
                  << cudaGetErrorString(err) << std::endl;
    }
    err = cudaGetDeviceCount(&deviceCount);
    if (err == cudaSuccess) {
        std::cout << "Detected " << deviceCount << " CUDA Capable device(s)."
                  << std::endl;
    } else {
        std::cerr << "Error: " << cudaGetErrorString(err)
                  << " when trying to get CUDA device count." << std::endl;
    }

    MainWindow w;
    w.show();
    return a.exec();
}
